package com.xuanwu.mall.goods.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xuanwu.mall.goods.entity.PmsBrand;
import com.xuanwu.mall.goods.entity.PmsCategory;
import com.xuanwu.mall.goods.mapper.PmsCategoryMapper;
import com.xuanwu.mall.goods.service.IPmsCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * xuanwu-mall
 * com.xuanwu.mall.goods.service.impl
 *
 * @Description: 商品三级分类 服务实现类
 * @Author：xuanwudeshuijngye_26567
 * @Date 2024-03-18 22:24
 * @Company: 旋舞科技有限公司
 **/
@Service
@Slf4j
public class PmsCategoryServiceImpl extends ServiceImpl<PmsCategoryMapper, PmsCategory> implements IPmsCategoryService {

    @Autowired
    private PmsCategoryMapper pmsCategoryMapper;
    /**
     * 根据分类父Id 查询所有子类
     * @param parentCid
     * @return
     */
    @Override
    public List<PmsCategory> findByParentId(Long parentCid) {
        LambdaQueryWrapper<PmsCategory> pmsCategoryLambdaQueryWrapper = new LambdaQueryWrapper<>();
        pmsCategoryLambdaQueryWrapper.eq(PmsCategory::getParentCid,parentCid);
        return pmsCategoryMapper.selectList(pmsCategoryLambdaQueryWrapper);
    }
}
